﻿using System.Windows;
using System.Windows.Input;

namespace MDCAdminTool.Commands
{
    public class RestartCacheHost : AsyncCommandBindingBase
    {
        public RestartCacheHost()
            : base()
        {
            Command = Application.Current.Resources["RestartCacheHost"] as ICommand;
        }

        protected override void OnExecuted( object sender , ExecutedRoutedEventArgs e )
        {
            var service = e.Parameter as ICacheCommand;
            if ( service != null ) service.Restart();
        }
        protected override void OnCanExecute( object sender , CanExecuteRoutedEventArgs e )
        {
            e.CanExecute = true;
        }
    }
}